# hash:sha256:ea2ada8cd64ac02cb7ac28019c84af42c9e27228530456f087f2602d8a09cb59
FROM registry.codeocean.ANON/codeocean/miniconda3:4.9.2-cuda11.7.0-cudnn8-ubuntu20.04

ARG DEBIAN_FRONTEND=noninteractive

ARG GIT_ASKPASS
ARG GIT_ACCESS_TOKEN
COPY git-askpass /

# Prevent Python from writing pyc files to disc (optional)
ENV PYTHONDONTWRITEBYTECODE 1
# Ensure Python output is sent straight to terminal (useful for logs)
ENV PYTHONUNBUFFERED 1

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        git \
        build-essential \
    && \
    # Clean up apt cache to reduce image size
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir \
    setuptools==65.5.1 \
    wheel==0.38.4 \
    numpy \
    scipy \
    scikit-learn \
    matplotlib \
    jupyterlab

RUN pip install --no-cache-dir gym==0.21.0

# --- Install PyTorch ---
# Install a PyTorch version compatible with Python 3.8.
# Example: PyTorch 1.11.0 (CPU version).
# Check the official PyTorch website (https://pytorch.org/get-started/previous-versions/)
# for other versions or GPU-compatible commands if needed.
#RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu torchaudio==0.11.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
RUN pip install --no-cache-dir torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113

# --- Install NeuroGym (Specific Older Version from Git) ---
# Clone the neurogym repository, check out the specific tag (v0.0.1),
# install it in editable mode (-e), and then remove the cloned repo to save space.
RUN git clone --branch v0.0.1 https://github.com/neurogym/neurogym.git /app/neurogym_install && \
    pip install --no-cache-dir -e /app/neurogym_install && \
    rm -rf /app/neurogym_install

# --- Install Mod-Cog (from Git) ---
# Clone the Mod_Cog repository.
# We don't install it via pip unless it has a setup.py designed for installation.
# Instead, we'll add its directory to the PYTHONPATH.
RUN git clone https://github.com/mikailkhona/Mod_Cog.git /app/Mod_Cog

# Add the Mod_Cog directory to the PYTHONPATH so Python can find its modules
ENV PYTHONPATH="${PYTHONPATH}:/Mod_Cog"

# --- Expose Ports ---
# Expose the default JupyterLab port
EXPOSE 8888


